        <div class="span12">
          <div class="well">
            注意店铺初始密码均为666666
          </div>
        </div>
        <div class="span6">

        <div class="control-group <%= "error" if @restaurant.errors[:name].length > 0 %>">
            <label class="control-label " for="name">登录账号</label>
            <div class="controls">
              <%= f.text_field :login,class:"grd-white",label:false,placeholder:"请输入登录称号"%>
              <% if @restaurant.errors[:name].length > 0  %>
                  <span class="help-inline"> <%= @restaurant.errors[:name].join(',') %></span>
              <% end %>
            </div>
          </div>

          <div class="control-group <%= "error" if @restaurant.errors[:name].length > 0 %>">
            <label class="control-label " for="name">名称</label>
            <div class="controls">
              <%= f.text_field :name,class:"grd-white",label:false,placeholder:"请输入名称"%>
              <% if @restaurant.errors[:name].length > 0  %>
                  <span class="help-inline"> <%= @restaurant.errors[:name].join(',') %></span>
              <% end %>
            </div>
          </div>

          <div class="control-group <%= "error" if @restaurant.errors[:phone].length > 0 %>">
            <label class="control-label " for="name">电话</label>
            <div class="controls">
              <%= f.text_field :phone,class:"grd-white",label:false,placeholder:"请输入电话"%>
              <% if @restaurant.errors[:phone].length > 0  %>
                  <span class="help-inline"> <%= @restaurant.errors[:phone].join(',') %></span>
              <% end %>
            </div>
          </div>

          <div class="control-group <%= "error" if @restaurant.errors[:address].length > 0 %>">
            <label class="control-label " for="name">地址</label>
            <div class="controls">
              <%= f.text_field :address,class:"grd-white",label:false,placeholder:"请输入地址"%>
              <% if @restaurant.errors[:address].length > 0  %>
                  <span class="help-inline"> <%= @restaurant.errors[:address].join(',') %></span>
              <% end %>
            </div>
          </div>
        </div>

        <div class="span6">
          <div class="row-fluid">
            <div class="span3">
              <%= f.file_field :attachment %>
            </div>
          </div>


        </div>
        <div class="span12">
          <div class="row-fluid">
            <div class="span12">
              <div class="control-group">
                <label class="control-label" for="price">餐厅描述</label>
                <%= f.text_area :description,rows:6,:style => "width:100%" %>
              </div>

            </div>

            <div class="span12">
              <%= f.submit '添加',class:"btn btn-large btn-primary" %>
              <%= link_to "取消","/admin/foods",class:"btn btn-large btn-default" %>
            </div>
          </div>

        </div>



<script type="text/javascript">
   $(function(){
     <% if @restaurant.attachment.url != nil %>
           $("#preview").empty().append("<%= j render :partial => "thumb_image" ,:locals => {image: @restaurant}%>");
     <% else %>
           $("#preview").empty().append("<img src='/img/no_product_200.jpg' />");
     <% end %>


//         $("#image_file").fileupload({
//             dataType:"script",
//             add: function(e,data){
//                 data.context = $(tmpl("template-upload",data.files[0]));
//                 $("#preview").empty();
//                 $("#preview").show();
//                 $("#preview").append(data.context);
//                 data.submit();


//             },
//             progress: function(e,data){
//                 if(data.context){
// //                    progress = parseInt(data.loaded/data.total*100,10);
// //                    data.context.find('.bar').css('width',progress+'%');
//                 }
//             },

//             done:function(e,data){
//                 data.context.hide();
// //                $("#progress").hide();

//             }
//         })

    });
</script>

<script id="template-upload" type="text/x-tmpl">
    <img src="/img/icon/loading.gif" width="280" height="180" />
</script>
